﻿using Zhaoxi.TakeaWay.DataAccess;
using Zhaoxi.TakeaWay.Model;

namespace Zhaoxi.TakeaWay.InitedatabaseNewTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            using (TakeaWayDbContext context = new TakeaWayDbContext())
            {
                context.Database.EnsureDeleted(); // 如果数据库存在  就删除数据库
                context.Database.EnsureCreated(); // 如果数据库不存在,就创建数据库


                //初始化类目
                context.Set<Category>().AddRange(new List<Category>()
                {
                    new Category() {  Title="美食外卖",Icon="#icon-meishi"},
                    new Category() {  Title="超市便利",Icon="#icon-chaoshi"},
                    new Category() {  Title="水果",Icon="#icon-shuiguo"},
                    new Category() {  Title="买菜",Icon="#icon-shucaiqu"},
                    new Category() {  Title="买药",Icon="#icon-yaoxiang"},
                    new Category() {  Title="电影/演出",Icon="#icon-dianying"},
                    new Category() {  Title="景点/门票",Icon="#icon-a-iconjingdian"},
                    new Category() {  Title="周边游/旅游",Icon="#icon-lvyou"},
                    new Category() {  Title="健身/游泳",Icon="#icon-jianshen"},
                    new Category() {  Title="跑腿",Icon="#icon-_waimai"},
                    new Category() {  Title="丽人/美发",Icon="#icon-meifa"},
                    new Category() {  Title="医学美容",Icon="#icon-nvren"},
                    new Category() {  Title="亲子/乐园",Icon="#icon-qinzi"},
                    new Category() {  Title="签到领现金",Icon="#icon-huiyuan1"},
                    new Category() {  Title="周边游/旅游",Icon="#icon-lvyou"},
                    new Category() {  Title="健身/游泳",Icon="#icon-jianshen"},
                    new Category() {  Title="跑腿",Icon="#icon-_waimai"},
                    new Category() {  Title="丽人/美发",Icon="#icon-meifa"},
                    new Category() {  Title="医学美容",Icon="#icon-nvren"},
                    new Category() {  Title="亲子/乐园",Icon="#icon-qinzi"},
                    new Category() {  Title="签到领现金",Icon="#icon-huiyuan1"}
                });

                ///初始化轮播图
                context.Set<RotationChart>().AddRange(new List<RotationChart>()
                {
                    new RotationChart()
                    {
                       CreateTime= DateTime.Now,
                       ImageUrl="images/Banner/banner-1.jpg",
                    },
                    new RotationChart()
                    {
                       CreateTime= DateTime.Now,
                       ImageUrl="images/Banner/banner-2.jpg",
                    },
                    new RotationChart()
                    {
                       CreateTime= DateTime.Now,
                       ImageUrl="images/Banner/banner-3.jpg",
                    },
                    new RotationChart()
                    {
                       CreateTime= DateTime.Now,
                       ImageUrl="images/Banner/banner-4.jpg",
                    },
                    new RotationChart()
                    {
                       CreateTime= DateTime.Now,
                       ImageUrl="images/Banner/banner-5.jpg"
                    },
                });

                ///初始化产品
                context.Set<Product>().AddRange(new List<Product>()
                {
                  new Product()
                  {
                    Image="images/product/main-1.png",
                    Title="榴莲+烤鸡+培根+甄选+夏威夷+水果",
                    Score="4.8分",
                    MonthSales="月售3565",
                    Deliveryquota="起送￥30",
                    Deliveryfee="免费配送",
                    Fullreduction="满50减9"
                  },
                  new Product()
                  {
                    Image="images/product/main-2.png",
                    Title="榴莲+烤鸡+培根+甄选+夏威夷+水果",
                    Score="4.8分",
                    MonthSales="月售3565",
                    Deliveryquota="起送￥30",
                    Deliveryfee="免费配送",
                    Fullreduction="满50减9"
                  },
                  new Product()
                  {
                    Image="images/product/main-3.png",
                    Title="榴莲+烤鸡+培根+甄选+夏威夷+水果",
                    Score="4.8分",
                    MonthSales="月售3565",
                    Deliveryquota="起送￥30",
                    Deliveryfee="免费配送",
                    Fullreduction="满50减9"
                  },
                  new Product()
                  {
                    Image="images/product/main-4.png",
                    Title="榴莲+烤鸡+培根+甄选+夏威夷+水果",
                    Score="4.8分",
                    MonthSales="月售3565",
                    Deliveryquota="起送￥30",
                    Deliveryfee="免费配送",
                    Fullreduction="满50减9"
                  },
                  new Product()
                  {
                    Image="images/product/main-5.png",
                    Title="榴莲+烤鸡+培根+甄选+夏威夷+水果",
                    Score="4.8分",
                    MonthSales="月售3565",
                    Deliveryquota="起送￥30",
                    Deliveryfee="免费配送",
                    Fullreduction="满50减9"
                  },
                  new Product()
                  {
                    Image="images/product/main-6.png",
                    Title="榴莲+烤鸡+培根+甄选+夏威夷+水果",
                    Score="4.8分",
                    MonthSales="月售3565",
                    Deliveryquota="起送￥30",
                    Deliveryfee="免费配送",
                    Fullreduction="满50减9"
                  }
                });

                context.SaveChanges();

            }
        }
    }
}